package com.accp.vehiclecare.biz.syhbiz;

import com.accp.vehiclecare.dao.syhdao.ISubjoinitemDao;
import com.accp.vehiclecare.pojo.Subjoinitem;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;

import javax.annotation.Resource;
import java.util.List;

@Service
public class SubjoinitemBiz {

    @Resource
    private ISubjoinitemDao dao;

    @Transactional(propagation = Propagation.REQUIRED)
    public boolean addSubjoinitem(Subjoinitem subjoinitem){
        return dao.insert(subjoinitem) > 0;
    }

    public List<Subjoinitem> querySub(String billNo){
        QueryWrapper qw = Wrappers.query();
        qw.eq("repairbillsno",billNo);
        return dao.selectList(qw);
    }

    @Transactional(propagation = Propagation.REQUIRED)
    public void removeSub(Integer id){
        dao.deleteById(id);
    }
}
